#测试auto_sop接收组装站asp传入过来的数据
from django.shortcuts import render,redirect
from mes import models
from urllib import request
from django.shortcuts import render
#连接mysql的类
import pymysql
import pymssql
#引入项目的settings文件
from django.conf import settings
def get_asp_data():
    if request.method == "GET":
        print("传输方式是GET")
    else:
        now_recorde_no = request.POST.get("ta002")
        connect = pymssql.connect(host='192.168.118.128',user='barcode',password='barcodefornexcom',database='MIS')
        sqlserver_select_test = connect.cursor()
        sql = "select * from auto_sop"
        sqlserver_select_test_result = sqlserver_select_test.execute(sql)



def return_static_html(request):
    return render(request,'all.html')




#-----------------峰米数据可视化页面---------------------
def fengmi_data_view(request):
    FengMi_Materail_all_data = (models.FengMi_Materail.objects.values_list())
    all_data_count = models.FengMi_Materail.objects.count()
    print(all_data_count)
    print(type(all_data_count))
    all_data_count = list(range(all_data_count))
    print(FengMi_Materail_all_data)
    print(type(all_data_count))
    # for i in all_data_count:
    #     print(type(i))
    #     print(FengMi_Materail_all_data[i])
    # print(type(FengMi_Materail_all_data))
    return render(request,'fengmi_data_view.html',{'FengMi_Materail_all_data':FengMi_Materail_all_data,'all_data_count':all_data_count,})
